build: Add dependency fallbacks for libs with meson ports
authorNirbheek Chauhan <nirbheek@centricular.com>
Thu, 7 Sep 2017 18:23:41 +0000 (23:53 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Mon, 11 Sep 2017 18:54:58 +0000 (00:24 +0530)
With these changes gtk+ builds for me using fallbacks for all libraries
with fallbacks available. Needs the following changes:

https://github.com/ebassi/graphene/pull/109 (graphene)
https://bugzilla.gnome.org/show_bug.cgi?id=787414 (pango)
https://github.com/mesonbuild/meson/pull/2291 (will be in meson 0.42.1)

https://bugzilla.gnome.org/show_bug.cgi?id=787416

gdk/meson.build
gtk/meson.build
meson.build
subprojects/gdk-pixbuf.wrap [new file with mode: 0644]
subprojects/glib.wrap [new file with mode: 0644]
subprojects/pango.wrap [new file with mode: 0644]

index f9afe7208c6fcddc7cc87d5d5507cdb2941f9ffc..16a1a3798284bc30396adbbed142995e6d695c59 100644 (file)
@@ -156,6 +156,7 @@ gdk_deps = [
   pango_dep,
   cairogobj_dep,
   glib_dep,
+  gobject_dep,
   epoxy_dep,
   fontconfig_dep,
   giounix_dep,
index cb04e9032115dfe76929b1a60c09d602fb9e3594..20b0410555efedda023b42c574a7d4f4d7bad2a0 100644 (file)
@@ -814,6 +814,7 @@ gtk_deps = [
   gmodule_dep,
   giounix_dep,
   glib_dep,
+  gobject_dep,
   atkbridge_dep,
   pangocairo_dep,
   pango_dep,
index 0b1df53499de8149c138bf3e2b2e154d47c52627..55dcdba7fa35878e386095c2a0b3b43a03ff03cd 100644 (file)
@@ -3,7 +3,9 @@ project('gtk+-4.0', 'c',
         default_options: [
           'buildtype=debugoptimized',
           'warning_level=1',
-          'c_std=c99',
+          # We only need c99, but glib needs GNU-specific features
+          # https://github.com/mesonbuild/meson/issues/2289
+          'c_std=gnu99',
         ],
         meson_version : '>= 0.40.0',
         license: 'LGPLv2.1+')
@@ -313,18 +315,27 @@ gtkinc = include_directories('gtk')
 testinc = include_directories('tests')
 
 # Dependencies
-glib_dep       = dependency('glib-2.0', version: glib_req)
-giounix_dep    = dependency('gio-unix-2.0', version: glib_req, required: false)
-pango_dep      = dependency('pango', version: pango_req)
-pangoft_dep    = dependency('pangoft2', required: wayland_enabled or x11_enabled)
+glib_dep       = dependency('glib-2.0', version: glib_req,
+                            fallback : ['glib', 'libglib_dep'])
+gobject_dep    = dependency('gobject-2.0', version: glib_req,
+                            fallback : ['glib', 'libgobject_dep'])
+giounix_dep    = dependency('gio-unix-2.0', version: glib_req, required: false,
+                            fallback : ['glib', 'libgio_dep'])
+gmodule_dep    = dependency('gmodule-2.0', version: glib_req,
+                            fallback : ['glib', 'libgmodule_dep'])
 cairo_dep      = dependency('cairo', version: cairo_req)
-pangocairo_dep = dependency('pangocairo', version: cairo_req)
 cairogobj_dep  = dependency('cairo-gobject', version: cairo_req)
-pixbuf_dep     = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req)
+pango_dep      = dependency('pango', version: pango_req,
+                            fallback : ['pango', 'libpango_dep'])
+pangoft_dep    = dependency('pangoft2', required: wayland_enabled or x11_enabled,
+                            fallback : ['pango', 'libpangoft2_dep'])
+pangocairo_dep = dependency('pangocairo', version: cairo_req,
+                            fallback : ['pango', 'libpangocairo_dep'])
+pixbuf_dep     = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
+                            fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'])
 epoxy_dep      = dependency('epoxy', version: epoxy_req,
                             fallback: ['libepoxy', 'libepoxy_dep'])
 atk_dep        = dependency('atk', version: atk_req)
-gmodule_dep    = dependency('gmodule-2.0', version: glib_req)
 harfbuzz_dep   = dependency('harfbuzz', version: '>= 0.9', required: false)
 xkbdep         = dependency('xkbcommon', version: xkbcommon_req)
 graphene_dep   = dependency('graphene-gobject-1.0', version: graphene_req,
@@ -483,8 +494,11 @@ if win32_enabled
   backend_immodules += ['ime']
 endif
 
-# Check for bind_textdomain_codeset, including -lintl if GLib brings it in
-if cc.has_function('bind_textdomain_codeset', dependencies: glib_dep)
+# Check for bind_textdomain_codeset, including -lintl if GLib brings it in by
+# doing the same check as glib. We can't check that by linking to glib because
+# it might be a subproject and hence not built yet.
+libintl_dep = cc.find_library('intl', required : false)
+if cc.has_function('bind_textdomain_codeset', dependencies: libintl_dep)
   cdata.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
 endif
 
diff --git a/subprojects/gdk-pixbuf.wrap b/subprojects/gdk-pixbuf.wrap
new file mode 100644 (file)
index 0000000..1d251c5
--- /dev/null
@@ -0,0 +1,5 @@
+[wrap-git]
+directory=gdk-pixbuf
+url=https://git.gnome.org/browse/gdk-pixbuf
+push-url=ssh://git.gnome.org/git/gdk-pixbuf
+revision=origin/master
diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap
new file mode 100644 (file)
index 0000000..17aa35a
--- /dev/null
@@ -0,0 +1,5 @@
+[wrap-git]
+directory=glib
+url=https://git.gnome.org/browse/glib
+push-url=ssh://git.gnome.org/git/glib
+revision=origin/master
diff --git a/subprojects/pango.wrap b/subprojects/pango.wrap
new file mode 100644 (file)
index 0000000..e7bc173
--- /dev/null
@@ -0,0 +1,5 @@
+[wrap-git]
+directory=pango
+url=https://git.gnome.org/browse/pango
+push-url=ssh://git.gnome.org/git/pango
+revision=origin/master